package com.itheima.controller;


import com.itheima.pojo.EmpJob;
import com.itheima.pojo.Result;
import com.itheima.pojo.StudentCount;
import com.itheima.service.ReportService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@Slf4j
@RestController
@RequestMapping("/report")
public class ReportController {
    @Autowired
    private ReportService reportService;

    //员工职位人数统计
    @GetMapping("/empJobData")
    public Result getEmpJobData() {
        EmpJob empJob = reportService.getEmpJobData();
        return Result.success(empJob);
    }

    //员工性别统计
    @GetMapping("/empGenderData")
    public Result getEmpGenderData() {
        List<Map<String,Object>> mapList = reportService.getEmpGenderData();
        return Result.success(mapList);
    }

    //学员学历统计
    @GetMapping("/studentDegreeData")
    public Result getStudentGenderData() {
        List<Map<String, Object>> mapList = reportService.getStudentGenderData();
        return Result.success(mapList);
    }

    //班级人数统计
    @GetMapping("/studentCountData")
    public Result getStudentCountData() {
        StudentCount studentCount = reportService.getStudentCountData();
        return Result.success(studentCount);
    }

}
